<template>
  <div class="cart">
    <!-- 导航栏 -->
    <nav-bar class="cart-nav-bar">
      <template #center>
        <div>购物车({{cartLength}})</div>
      </template>
    </nav-bar>
    <!-- 商品列表 -->
    <cart-list />

    <!-- 底部汇总 -->
    <cart-button-bar />
  </div>
</template>

<script>
import NavBar from "components/common/navbar/NavBar";
import CartList from "./childComps/CartList";
import CartButtonBar from "./childComps/CartBottomBar";

import { mapGetters } from "vuex";
export default {
  name: "Cart",
  components: {
    NavBar,
    CartList,
    CartButtonBar,
  },
  computed: {
    //两种语法
    ...mapGetters(["cartLength"]),
    // ...mapGetters({
    //   length: "cartLength",
    //   list: "cartList",
    // }),
  },
};
</script>

<style scpoed>
.cart-nav-bar {
  background-color: var(--color-tint);
  color: #fff;
}
</style>